package face.pay.common.enterprise.service.impl;

import face.pay.common.enterprise.service.IWeChatMchInfoService;
import face.pay.dao.WeChatMchInfoDao;
import face.pay.entity.UserInfo;
import face.pay.entity.WeChatMchInfo;
import face.pay.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class WeChatMchInfoServiceImpl implements IWeChatMchInfoService {

    @Autowired
    WeChatMchInfoDao weChatMchInfoDao;

    @Override
    public WeChatMchInfo getByUserId(Integer userId) {
        return weChatMchInfoDao.queryByUserId(userId);
    }

    public WeChatMchInfoDao getWeChatMchInfoDao() {
        return weChatMchInfoDao;
    }

    public void setWeChatMchInfoDao(WeChatMchInfoDao weChatMchInfoDao) {
        this.weChatMchInfoDao = weChatMchInfoDao;
    }

    @Override
    public ResultMessage modifyInfo(WeChatMchInfo weChatMchInfo, UserInfo loginUser) {
         this.weChatMchInfoDao.update(weChatMchInfo);
         return ResultMessage.createSuccess("保存成功");
    }

    @Override
    public void insert(WeChatMchInfo weChatMchInfo, UserInfo loginUser) {
         weChatMchInfo.setOemId(loginUser.getOemId());
         this.weChatMchInfoDao.insert(weChatMchInfo);
    }
}
